<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */

abstract class FW_Session_SaveHandler_Abstract
{
    /**
     * Opens a session and retrieves its resources.
     * @param string $path
     * @param string $name
     */
    abstract public function open($path, $name);

    /**
     * Closes a session and frees its resources
     */
    abstract public function close();

    /**
     * Reads the data of the session with the given id.
     * @param string $id
     */
    abstract public function read($id);

    /**
     * Writes and commits session data to resource.
     * @param string $id
     * @param mixed $data
     */
    abstract public function write($id, $data);

    /**
     * Destroy the session with the given id and removes data from the resource for given session id
     * @param string $id
     */
    abstract public function destroy($id);

    /**
     * Collects garbage by removing session data which is older than $maxlifetime (in seconds)
     * @param int $maxlifetime
     */
    abstract public function gc($maxlifetime);
}
